package com.windoent.yugioh.utils;

/**
 * author : robert
 * date   : 2021/5/31 13:48
 * desc   :
 */
public class XingUtils {

    public static String xingName(String name) {
        String result = "";
        if (BaseMethod.notNull(name) && name.length() > 0) {
            result = name.substring(0, 1);
            for (int i = 0; i < name.length(); i++) {
                result += "*";
            }
        }
        return result;
    }

    public static String xingPhone(String phone) {
        String result = "";
        if (BaseMethod.notNull(phone) && phone.length() > 0) {
            if (phone.length() > 3) {
                result = phone.substring(0, 3);
                result += "****";
                result += phone.substring(phone.length() - 3, phone.length());
            }
        }
        return result;
    }

    public static String xingEmail(String email) {
        String result = "";
        if (BaseMethod.notNull(email) && email.length() > 0) {
            if (email.length() > 2) {
                result = email.substring(0, 2);
                result += "****";
                result += email.substring(email.length() - 2, email.length());
            }
        }
        return result;
    }

    public static String xingID(String id) {
        String result = "";
        if (BaseMethod.notNull(id) && id.length() > 0) {
            if (id.length() > 4) {
                result = id.substring(0, 4);
                result += "****";
                result += id.substring(id.length() - 4, id.length());
            }
        }
        return result;
    }
}
